package com.power.using.mybomb.ui;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import androidx.annotation.Nullable;

import com.power.using.mybomb.MainActivity;
import com.power.using.mybomb.R;
import com.power.using.mybomb.base.BaseActivity;
import com.power.using.mybomb.bean.User;
import com.power.using.mybomb.model.UserModel;

/**
 * Created by 聪明一只哈 on 2020/3/19.
 * Time: 2020/3/19  15:26
 */
public class SplashActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        Handler handler = new Handler(Looper.getMainLooper());
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                User user = UserModel.getInstance().getCurrentUser();
                if(user==null){
                    startActivity(LoginActivity.class,null,true);
                }else{
                    startActivity(MainActivity.class,null,true);
                }
            }
        },1000);


    }
}
